<?php

namespace App\Http\Controllers\Cruise\Merchant;

use App\Http\Controllers\BaseController;
use App\Http\Middleware\OpenShop\MerchantAppAuth;
use App\Service\Cruise\Check\CruiseCheckAgainstService;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class CruiseCheckAgainstController extends BaseController
{


    /**
     * 门店违约函版本预览返回数据
     * @param Request $request
     * @param int $id
     * @return JsonResponse
     * @throws GuzzleException
     */
    public function shopVersionPreview(Request $request, int $id): JsonResponse
    {
        return $this->success(CruiseCheckAgainstService::shopVersionPreview(0, $id, 1));
    }

    /**
     * 商家确认违约函
     * @param Request $request
     * @param $id
     * @return JsonResponse
     */
    public function confirm(Request $request, $id): JsonResponse
    {
        CruiseCheckAgainstService::confirm(MerchantAppAuth::$userId, $id);
        return $this->success();
    }


}
